<?php

namespace App\Admin\Renderable;

use App\Models\PaperFeedback;
use Dcat\Admin\Support\LazyRenderable;
use Dcat\Admin\Widgets\Table;

class PaperFeedbacksSelect extends LazyRenderable
{
    public function render()
    {
        $id = $this->payload['id'];
        $paper_feedbacks = PaperFeedback::find($id);

//        $dataInfo = json_decode($paper_feedbacks->subject_select, true);
        $dataInfo = $paper_feedbacks->subject_select;

        $selectList = [];
        foreach ($dataInfo as $dataInfoVal) {
            array_push($selectList, [$dataInfoVal['num'], $dataInfoVal['content']]);
        }

        return Table::make(['选项', '内容'], $selectList);
    }
}